home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / src / useful.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-01  |  3.1 KB  |  115 lines

  1. /*
  2.  * Copyright (c) 1988 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted provided
  6.  * that: (1) source distributions retain this entire copyright notice and
  7.  * comment, and (2) distributions including binaries display the following
  8.  * acknowledgement:  ``This product includes software developed by the
  9.  * University of California, Berkeley and its contributors'' in the
  10.  * documentation or other materials provided with the distribution and in
  11.  * all advertising materials mentioning features or use of this software.
  12.  * Neither the name of the University nor the names of its contributors may
  13.  * be used to endorse or promote products derived from this software without
  14.  * specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  16.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  17.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *    @(#)useful.h    4.6 (Berkeley) 6/1/90
  20.  */
  21.  
  22. #ifndef lint
  23. # ifdef _DEFINE
  24. static char useful_h_sccsid[] = "@(#)useful.h    4.6 (Berkeley) 6/1/9";
  25. static char useful_h_rcsid[] = "@(#)$Id: useful.h,v 4.6.0.10 1991/06/24 20:18:55 paul Exp $";
  26. # endif /* _DEFINE */
  27. #endif /* !lint */
  28.  
  29. #include <sys/types.h>
  30.  
  31. /* support for bool type.  going from char to int increased BSS by 16 bytes */
  32. typedef int    bool;
  33. #define TRUE    1
  34. #define FALSE    0
  35.  
  36. #ifndef NULL
  37. # define NULL    0
  38. #endif /* NULL */
  39.  
  40. /* bit hacking */
  41. #define bitset(bit, word)    (((word) & (bit)) != 0)
  42.  
  43. /* some simple functions */
  44. #ifndef max
  45. # define max(a, b)    ((a) > (b) ? (a) : (b))
  46. # define min(a, b)    ((a) < (b) ? (a) : (b))
  47. #endif /* !max */
  48.  
  49. /* assertions */
  50. #ifndef NASSERT
  51. # define ASSERT(expr, msg, parm)\
  52.     if (!(expr))\
  53.     {\
  54.         fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\
  55.         fprintf(stderr, msg, parm);\
  56.     }
  57. #else /* !NASSERT */
  58. # define ASSERT(expr, msg, parm)
  59. #endif /* NASSERT */
  60.  
  61. /* define the types of some common functions */
  62. #ifdef __STDC__
  63. # include <string.h>
  64. # ifndef __STRICT_BSD__
  65. #  include <unistd.h>
  66. #  include <stdlib.h>
  67. # endif /* !__STRICT_BSD__ */
  68. #else /* !__STDC__ */
  69. extern char    *strcpy(), *strncpy();
  70. extern char    *strcat(), *strncat();
  71. extern char    *malloc();
  72. extern TIME_TYPE    time();
  73. extern char    *ctime();
  74. extern char    *getenv();
  75. #endif /* __STDC__ */
  76. extern int    errno;
  77.  
  78. #ifndef SYSV
  79. extern char    *index(), *rindex();
  80. #else /* SYSV */
  81. # include <fcntl.h>
  82. # ifndef O_SYNC
  83. #  ifdef O_DIRECT
  84. #   define    O_SYNC    O_DIRECT
  85. #  endif /* O_DIRECT */
  86. # endif /* !O_SYNC */
  87. # define    index        strchr
  88. # define    rindex        strrchr
  89. # define    bcopy(h,a,l)    memcpy(a,h,l)
  90. # define    bzero(s,n)    memset(s,0,n)
  91. # define    bcmp        memcmp
  92. # define    vfork        fork
  93. # ifndef NOFILE
  94. #  include <sys/param.h>
  95. # endif /* NOFILE */
  96. # define    getdtablesize()    NOFILE
  97. # ifndef SIGCHLD
  98. #  define    SIGCHLD        SIGCLD
  99. # endif /* !SIGCHLD */
  100. # define    direct        dirent
  101. # ifdef ISC
  102. #  include <sys/dirent.h>
  103. # else /* !ISC */
  104. #  include <dirent.h>
  105. # endif /* ISC */
  106. extern    char    *strchr(),    *strrchr();
  107. # include <grp.h>
  108. # ifndef NGROUPS_MAX
  109. #  define    initgroups(u,g)    kill(0,0)
  110. # endif /* !NGROUPS_MAX */
  111. # ifndef MAX
  112. #  define    MAX(a,b)    ((a)>(b))?(a):(b)
  113. # endif /* !MAX */
  114. #endif /* !SYSV */
  115.